home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / src / das / sect.h < prev    next >
C/C++ Source or Header  |  1997-09-09  |  2KB  |  81 lines

  1.  
  2. /*
  3.  *  DAS/SECT.H
  4.  *
  5.  *
  6.  *    (c)Copyright 1992-1997 Obvious Implementations Corp.  Redistribution and
  7.  *    use is allowed under the terms of the DICE-LICENSE FILE,
  8.  *    DICE-LICENSE.TXT.
  9.  */
  10.  
  11. #define SECTBLKSIZE    8192    /*  allocation size */
  12.  
  13. /*
  14.  *  Relocation and section information.  The section is broken up into
  15.  *  relocation lists for byte, word, and long relocations for local and
  16.  *  external symbols.  Each list itself is kept sorted by the SECTION HUNK THE
  17.  *  LOCAL OR EXTERNAL LABEL BELONGS TO.
  18.  *
  19.  *  labels exported from this section are placed on the export list.  Labels
  20.  *  imported into this section are listed via the Reloc lists.
  21.  */
  22.  
  23. typedef struct Reloc {
  24.     struct Reloc *RNext;
  25.     Label   *Label;        /*  label we are referencing            */
  26.     long    Offset;        /*  offset in section of item to be relocd  */
  27. } Reloc;
  28.  
  29. typedef struct DBlock {
  30.     struct DBlock *Next;
  31.     long    Size;
  32.     long    Max;
  33.     void    *Data;
  34. } DBlock;
  35.  
  36. #define RELOC_ABSOLUTE    0x0000
  37. #define RELOC_DATAREL    0x0100
  38. #define RELOC_PCREL    0x0200
  39.  
  40. #define SECT_DUMMY  0
  41. #define SECT_CODE   1
  42. #define SECT_DATA   2
  43. #define SECT_BSS    3
  44. #define SECT_ABS    4
  45. #define SECT_COMMON 5
  46.  
  47. typedef struct Sect {
  48.     struct Sect *Next;
  49.     short   Hunk;        /*    starts at 0        */
  50.     short   Type;        /*    code, data, bss, abs*/
  51.     long    HunkMask;
  52.     char    *Name;        /*    section name        */
  53.     long    Addr;        /*    current addr in sect*/
  54.  
  55.     long    ObjLen;        /*    size of generated code/data        */
  56.     long    DebugLen;        /*    debug entries                */
  57.     long    DebugIdx;
  58.     DBlock  *Block;        /*    linked list of generated code/data. NULL if bss */
  59.     DBlock  *LastBlock;     /*    for appending...            */
  60.  
  61.     Reloc   *RelocAry[10];
  62.     Label   *XDefLab;        /*    exported        */
  63.     struct DebugNode   *DebugAry;
  64. } Sect;
  65.  
  66. #define RA_EXT    5
  67.  
  68. #define r_ByteReloc        RelocAry[0]
  69. #define r_WordRelocPc        RelocAry[1]
  70. #define r_LongReloc        RelocAry[2]
  71. #define r_WordDataReloc     RelocAry[3]
  72. #define r_LongRelocPc        RelocAry[4]
  73. #define r_ExtByteReloc        RelocAry[5]
  74. #define r_ExtWordRelocPc    RelocAry[6]
  75. #define r_ExtLongReloc        RelocAry[7]
  76. #define r_ExtWordDataReloc  RelocAry[8]
  77. #define r_ExtLongRelocPc    RelocAry[9]
  78.  
  79. extern Sect    *CurSection;    /*  current section    */
  80. extern Sect    *SectBase;    /*  list of sections    */
  81.